var signature_path;

function init() {
	_initHeader();
	
	var array = new Array();
	array.push("서명");
	array.push("서명삭제");
	
	draw_list(array);
}

function setOnListClickHandler(idx) {
	switch(idx) {
		case 0 :
			testDigitalSignatureHandler();
		break;
		
		case 1 :
			testDeleteSignatureHandler();
		break;
		
		default :
		break;
	}
	
}
/*
 * testDigitalSignatureHandler
 */
function testDigitalSignatureHandler() {
	  var option = {
		      "width" : 500,
		      "height" : 400,
		      "x" : window.event.x,
		      "y" : window.event.y
		  }

		  jsniCaller.invoke("DigitalSignatureJSNI.showDigitalSignatureDialog", JSON.stringify(option), "showDigitalSignatureCallback");
}

function showDigitalSignatureCallback(param) {
	signature_path = param;
	
	alert("서비스 처리가 종료 되었습니다.");
	alert("path:" + signature_path);
}

/*
 * testDeleteSignatureHandler
 */
function testDeleteSignatureHandler() {
	if(isValid(signature_path)) {
		jsniCaller.invoke("DigitalSignatureJSNI.deleteDigitalSignature", signature_path, "deleteDigitalSignatureCallback");
		signature_path = null;
	} else {
		alert("서명이미지가 없습니다.");
	}
}

function deleteDigitalSignatureCallback(param) {
	if(param) {
		alert("서명이미지를 삭제하였습니다.");
	} else {
		alert("서명이미지 삭제가 실패하였습니다.");
	}
}
